home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Serious Software / POV-Ray 3.1 / Scenes / animate / float4 / float4.pov < prev   
Encoding:
Text File  |  1998-03-01  |  1.7 KB  |  64 lines  |  [TEXT/POV3]

  1. // Persistence Of Vision Raytracer version 3.1 sample file.
  2. // FLOAT4.POV
  3. // Animate this scene with clock values +ki0.0 to +kf1.0
  4. // Demonstrate sqrt, pow, degrees & atan2 as well as Pythagorean Theorm
  5. // using a 3-4-5 triangle and some boxes.
  6.  
  7. global_settings { assumed_gamma 2.2 }
  8.  
  9. #include "colors.inc"
  10.  
  11. #declare Rad=1/6;
  12. #declare Font="cyrvetic.ttf"
  13.  
  14. camera {
  15.    location  <0, 0, -140>
  16.    direction <0, 0,  11>
  17.    look_at   <0, 0,   0>
  18. }
  19.  
  20. light_source { <5000, 10000, -20000> color White}
  21. plane { z, Rad hollow on pigment {checker color rgb <1,.8,.8> color rgb <1,1,.8>} }
  22.  
  23. #declare A=4;
  24. #declare B=3*clock;
  25. #declare C=sqrt(pow(A,2)+pow(B,2));
  26. #declare Angle_b=atan2(B,A);
  27. #declare b_Degrees=degrees(Angle_b);
  28.  
  29. union {
  30.   box{0,<A,-A,1>
  31.     pigment {checker Yellow , Red}
  32.   }
  33.  
  34.   box{0,<B,B,1>
  35.     pigment {checker Yellow , Blue} 
  36.     translate x*A
  37.   }
  38.   box{0,<C,C,1>
  39.     pigment {checker Yellow , Green} 
  40.     rotate z*b_Degrees
  41.   }
  42.  
  43.   intersection{
  44.     box{0,2}
  45.     cylinder{-z,z,2}
  46.     cylinder{-z,z,1.75 inverse}
  47.     translate z*.1
  48.     pigment{Magenta*.7}
  49.   }
  50.  
  51.   text{ttf Font "A=4",0.1,0 translate <1,-5,0> pigment{Red}}
  52.   text{ttf Font concat("B=",str(B,1,2)),0.1,0 translate <4.25,-1.25,0> pigment{Blue}}
  53.   text{ttf Font "C=sqrt(pow(B,2)",0.1,0  translate <-9,2,0> pigment{Green}}
  54.   text{ttf Font "+pow(C,2))",0.1,0  translate <-7,1,0> pigment{Green}}
  55.   text{ttf Font concat("C=",str(C,1,2)),0.1,0 pigment{Green}
  56.        translate (C+0.3)*y 
  57.        rotate z*b_Degrees
  58.       }
  59.   text{ttf Font concat("b=atan2(B,C)=",str(Angle_b,1,2)),0.1,0 translate <-9,-1,0> pigment{Magenta*.7}}
  60.   text{ttf Font concat("degrees(b)=",str(b_Degrees,1,2)),0.1,0 translate <-8.5,-2,0> pigment{Magenta*.7}}
  61.  
  62.   translate x-y
  63. }
  64.